<html>

  <head>

    <meta name= "viewport" content= "width=device-width" http-equiv="Content-Type"/>
    <title>Using a custom collision model for your custom visual model</title>
    <link rel="icon" type="image.jpg" href="../../images/icon.png" />
    <link rel="stylesheet" href="../../styles.css" type="text/css">

  </head>

  <body>

    <div class="start">
      <div class="title">
        <h1>Using a custom collision model for your custom visual model</h1> 
      </div>
    </div>

    <div class="main">

      <div class="right">

        <h3>Index</h3>
        <hr>

        <p>1. <a href="../../index.html">Introduction</a></p>
        <p>2. <a href="../tutorials.html">Tutorials</a></p>
        <p>3. <a href="../resources.html">Resources</a></p>

      </div>

    <div class="left">
      
    <h2>Contents</h2>
    <hr>

				<p>1. <a href="#tools">Required tools</a></p>
				<p>2. <a href="#tutorials">Required tutorials</a></p>
				<p>3. <a href="#steps">Steps</a></p>

				<br>

    <hr id="tools">
    <h2>Required tools</h2>
    <hr>
    
      <p>Refer to the "Resources" section for download.</p>

      <p>- Blender</p>
      <p>- SuperBMD</p>
      <p>- j3dview</p>
      <p>- Any text editor you like (Notepad++ is recommended)</p>
      <p>- NeoKCLCreate</p>
      <p>- Arc Convertor</p>
      <p>- Whitehole</p>
      <p>- Wiimm's ISO Tools (to get your SMG1 dump)</p>

      <br>

    <hr id="tutorials">
    <h2>Required tutorials</h2>
    <hr>

      <p>- <a href="t1.html">How to import a custom model into SMG1</a></p>
      <p>- <a href="t2.html">How to import a custom model into SMG1 with 1 in-game material</a></p>
      <p>- <a href="t3.html">How to import a custom model into SMG1 with 2 or more in-game materials</a></p>
      <p>- <a href="t4.html">Custom model with an animated in-game material</a></p>
      <p>- <a href="t5.html">Let's make some ice!</a></p>
      <p>- <a href="t6.html">Let's make some water!</a></p>

      <br>

    <hr id="steps">
    <h2>Steps &emsp;&emsp;&emsp; &emsp;&emsp;&emsp; &emsp;&emsp;&emsp; &emsp;&emsp;&emsp; &emsp;&emsp;&emsp; files used: <a href="https://archive.org/download/humming-owl-storage/tutorial7.zip">tutorial7.zip</a></h2>
    <hr>

      <p>The title of this tutorial might not be very <b>self-explanatory</b> so let me elaborate a little after starting.</p>

      <p>When importing a <b>custom model</b> into <b>SMG1</b> you have to export a <b>FBX and OBJ</b> file of your <b>Blender</b> model so you can convert the <b>FBX</b> through some processes into a <b>BDL</b> and the <b>OBJ</b> through some other processes into a <b>KCL and a PA files</b>.</p>

      <p>The <b>BDL file</b> is the <b>3D model</b> of the model you want to import into the game. In other words, it is the <b>visual part</b> of the model. And the <b>KCL and PA files</b> are the <b>collision part</b> of the model.</p>

      <p>When making a <b>simple model</b> we get both <b>FBX and OBJ files</b> from the same <b>Blender</b> model and that is because we are assuming that the <b>visual model</b> will have a <b>collision</b> shaped the same as the <b>visual model</b> (like in the <b>first tutorials</b>). In some cases you need to define for a <b>custom model</b> a <b>custom collision model</b>, the reason behind this is that you don’t want <b>collision</b> for some parts of the <b>visual model</b>. Why? You may ask, well, might be because not everything we want on our model is <b>completely solid</b> (maybe we are making a <b>water model</b>, water isn’t solid), or, we are defining a <b>better collision</b> for our model so it isn’t annoying for a player to interact with it, or, we don’t need <b>collision</b> at all because it is a <b>decorative model</b>. In each case that would be a <b>custom collision</b>.</p>

      <p>For this tutorial I will show the case for defining a <b>better collision</b> for a model so let’s take a look at <b>Fig. 1a and 1b</b>. It is a very <b>standard staircase</b>.</p>

      <img src="../../images/t7/Fig 1a.jpg">
      <b><p class="idtext">(Fig. 1a - Custom model example - Staircase)</p></b>
      <br>

      <img src="../../images/t7/Fig 1b.jpg">
      <b><p class="idtext">(Fig. 1b - Example model with its materials applied)</p></b>
      <br>

      <table>
        <tr>
          <td><b>Material</b></td>
          <td><b>Object</b></td>
        </tr>
        <tr>
          <td>MetalMat</td>
          <td>UFOStrongA - SMG1</td>
        </tr>
        <tr>
          <td>WoodMat_v</td>
          <td>DiskGardenPlanet - SMG1</td>
        </tr>
      </table>


      <p>I don’t want the <b>collision</b> for this model being the same as the <b>visual model</b>; <b>I want Mario walking over the stairs as a ramp so that jumping isn’t necessary</b> to climb each stair step to get on top of the <b>custom model</b>. A model like the one shown on <b>Fig. 2</b> is the best for that.</p>

      <img src="../../images/t7/Fig 2.jpg">
      <b><p class="idtext">(Fig. 2 - Collision model for the visual model)</p></b>
      <br>

      <p>So my <b>FBX file</b> will be the <b>staircase model</b> and my <b>OBJ file</b> will be the <b>ramp model</b>. Be sure to add the same <b>materials</b> in the <b>same/similar faces</b> of the <b>collision model</b> as in the <b>visual model</b> so that you can apply the respective <b>collision properties</b> of it in <b>NeoKCLCreate</b> (the same <b>materials</b> just to know which parts of the <b>collision model</b> should have a <b>collision setting</b> determined by the <b>visual model</b>, <b>Fig. 3</b>).</p>

      <img src="../../images/t7/Fig 3.jpg">
      <b><p class="idtext">(Fig. 3 - Collision model with the same materials applied)</p></b>
      <br>

      <hr>
      <p><b>NOTE 1:</b> you don’t have to add <b>textures</b> for the <b>materials</b> on the <b>collision model</b>, just assign the <b>materials</b>. I just did it so you can view which were those <b>similar faces</b> I mentioned before.</p>

      <p><b>NOTE 2:</b> As a suggestion keep both of your <b>collision and visual models</b> into different <b>Blender projects</b>. You can keep them on the same project if you know what you are doing.</p>

      <p><b>NOTE 3:</b> As you are using different models for the <b>visual part</b> and the <b>collision part</b> of the <b>custom model</b> you only need to <b>triangulate</b> the <b>custom collision model</b>.</p>
      <hr>
      
      <br>

      <p>After exporting the <b>visual model</b> in a <b>FBX</b> and the <b>collision model</b> in <b>OBJ</b> (be sure they are <b>oriented/sized</b> the same so they show in the same place in game), convert the <b>FBX model</b> into a <b>BDL</b> with <b>SuperBMD</b> and <b>j3dview</b>, and, convert the <b>OBJ file</b> in a <b>KCL and PA files</b> with <b>NeoKCLCreate</b> indicating your <b>collision preferences</b> (<b>Fig. 4</b>).</p>

      <img src="../../images/t7/Fig 4.jpg">
      <b><p class="idtext">(Fig. 4 - Collision model's OBJ file opened in <code>NeoKCLCreate</code> under <code>Wine</code> on Linux)</p></b>
      <br>

      <p>Finally, do the rest you know to pack those into an <b>ARC file</b> (<b>BDL, KCL and PA</b>) and test them on game to see if they are positioned/working correctly as you expect (<b>Fig. 5</b>).</p>

      <img src="../../images/t7/Fig 5.jpg">
      <b><p class="idtext">(Fig. 5 - Mario grabbing to the collision model, the diagonal of the ramp)</p></b>
      <br>

      <hr>
      <p><b>NOTE 4</b>: if you want <b>no collision</b> for your model you can simply not add any <b>KCL and PA files</b> into the respective <b>ARC file</b>. If you keep only the <b>BDL file</b> of your <b>custom model</b> in the <b>ARC file</b>, you will pass through it in the game as if it was a ghost.</p>
      <hr>
      <br>

      </div>

    </div>

  </body>

</html>
